{extend name="base" /}
{block name="title"}
<title>招聘管理</title>
{/block}
{block name="content"}

<fieldset class="layui-elem-field layui-field-title">
    <legend>
        <span class="layui-breadcrumb">
            <a><cite>招聘管理</cite></a>
        </span>
    </legend>
    <br>
    <!--<a href="{:url('admin/lunbo/add', ['type' => request()->route('type')])}" class="layui-btn">添加教育团队</a>
    <a href="{:url('admin/lunbo/index', ['type' => request()->route('type')])}" class="layui-btn layui-btn-normal" target="">教育团队列表</a>-->
</fieldset>
<!--<fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
    <legend>方框风格的表单集合</legend>
</fieldset>-->

<form class="layui-form layui-form-pane" action="" method="post">
    <table class="layui-table">
        <colayui-inputroup>
            <col width="10%">
            <col width="60%">
            <col width="20%">
        </colayui-inputroup>
        <thead>
        <tr>
            <th class="tc">名称</th>
            <th class="tc">输入内容</th>
            <th class="tc">描述</th>
        </tr>
        </thead>
        <tbody>

        <tr align="center">
            <td  align="center" colspan="3" style="height: 40px;"><b>1.内容区块管理</b></td>
        </tr>

        <tr>
            <th><i class="require"></i>招聘管理</th>
            <td class="td-father">
                <?php foreach($data['team_title'] as $k=>$v) { if(empty($v)) continue; ?>
                <div class="father">
                    <div class="right-div">
                        <div class="layui-form-item">
                            <label class="layui-form-label">职位名称:</label>
                            <div class="layui-input-block">
                                <input type="text" name="team_title[]" value="{$v}" lay-verify="required" placeholder="请输入名称" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">职位描述:</label>
                            <div class="layui-input-block">
                                <textarea name="team_desc[]" placeholder="请输入内容" class="layui-textarea" style="height: 200px;"><?php echo $data['team_desc'][$k];?></textarea>
                            </div>
                        </div>
                    </div>
                    <a href="javascript:;" onclick="addDiv(this)">[+]</a>&nbsp;
                    <a href="javascript:;" onclick="removeDiv(this)">[-]</a>
                    <hr>
                </div>
                <?php }?>

            </td>
            <td></td>
        </tr>

        <tr>
            <td colspan="2">
                <div class="layui-form-item">
                    <!--<button class="layui-btn" lay-submit="" lay-filter="sub">提交</button>-->
                    <input type="submit" class="layui-btn" value="提交">
                </div>
            </td>
            <td></td>
        </tr>
        </tbody>
    </table>
</form>
{/block}
{block name="js"}
<script type="text/javascript" src="__ORG__/js/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
    layui.use(['form', 'layedit', 'laydate','element','upload'], function () {
        var form = layui.form(), layer = layui.layer, layedit = layui.layedit, $ = layui.jquery;

        //创建一个编辑器
        var editIndex = layedit.build('LAY_demo_editor');

        //自定义验证规则
        form.verify({
            name: function (value) {
                if (value.length < 2) {
                    return '标题至少得2个字符啊';
                }
            }
            , pass: [/(.+){6,12}$/, '密码必须6到12位']
            , content: function (value) {
                layedit.sync(editIndex);
            }
        });

        //监听提交
        form.on('submit(sub)', function (data) {
            /*layer.alert(JSON.stringify(data.field), {
             title: '最终的提交信息'
             });*/
            return true;
        });

        // you code ...

    });

    function addDiv(obj) {
        var row = $(obj).parent().clone();
        $('.td-father').append(row);
    }
    //删除元素
    function removeDiv(obj) {
        var i = $('.td-father > div').length;
        if (i > 1) {
            $(obj).parent().remove();
        }else {
            alert('至少保留一项');
        }
    }
</script>
{/block}